/*
 
 
 */

#import "XBCommunityLabel.h"
#import "Header.h"

@implementation XBCommunityLabel

#pragma mark - ======== 初始化方法 ========
- (instancetype)initWithTitle:(NSString *)title
{
    if (self = [super init]) {
        
        [self setupWithTitle:title];
    }
    return self;
}

- (void)setupWithTitle:(NSString *)title
{
    // 设置内容
    self.text = title;
    // 设置字体
    self.font = [UIFont systemFontOfSize:fontSelected];
    // 居中
    self.textAlignment = NSTextAlignmentCenter;
    // 自适应大小
    [self sizeToFit];
    // 设置可交互
    self.userInteractionEnabled = YES;
    // 设置字体
    self.font = [UIFont systemFontOfSize:fontNormal];
}

#pragma mark - ======== touchesBegan ========
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    if (self.selectedlabel) {
        self.selectedlabel();
    }
}


@end
